package cn.support.neo.mvp.ui.presenter;

import java.util.concurrent.TimeUnit;

import cn.support.neo.mvp.core.base.XView;
import cn.support.neo.mvp.core.easymvp.RxPresenter;
import cn.support.neo.mvp.model.usercase.CurrentDate;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

/**
 * <b>Name:</b>xx页面<br>
 * <b>Author:</b> WK（wangkun@xjzhicheng.com)<br>
 * <b>Date:</b>  2017-03-31<br>
 * <b>Describe:</b><p> PLEASE TO FIXME...</p><br>
 * <p>代码说明：（重点）<br>
 * <ol>
 * <li> write something content..</li>
 * </ol>
 * </p>
 * <b>Version:</b>V1.0<br>
 * <b>Revision History:</b>
 * <ul>
 * v1.x<li>1.write something content..。<br>2.write something content..<br>3.write something content..<br></li>
 * </ul>
 * <br>
 */
public class MainPresenter extends RxPresenter<XView> {

    private static final String TAG = MainPresenter.class.getSimpleName();

    /**
     * 获得当前日期
     */
    public void getCurrentDate(String param) {
        addSubscription(new CurrentDate(
                AndroidSchedulers::mainThread,
                Schedulers::io)
                .execute(param)
                .delaySubscription(2, TimeUnit.SECONDS)//延迟两秒订阅
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(
                        s -> getView().onResultCallBack(s),
                        throwable -> getView().onError(throwable.getMessage())
                )
        );
    }

    public void getDoSomething(){

    }

}

